mruby
4.0.0
mruby is the lightweight implementation of the Ruby language
Loading...
Searching...
No Matches
include
mruby
object.h
Go to the documentation of this file.
1
6
7
#ifndef MRUBY_OBJECT_H
8
#define MRUBY_OBJECT_H
9
10
#define MRB_OBJECT_HEADER \
11
struct RClass *c; \
12
enum mrb_vtype tt:8; \
13
unsigned int gc_color:3; \
14
unsigned int frozen:1; \
15
uint32_t flags:20
16
17
#define MRB_FLAG_TEST(obj, flag) ((obj)->flags & (flag))
18
19
struct
RBasic
{
20
MRB_OBJECT_HEADER;
21
};
22
#define mrb_basic_ptr(v) ((struct RBasic*)(mrb_ptr(v)))
23
24
#define MRB_OBJ_IS_FROZEN 1
25
#define mrb_frozen_p(o) ((o)->frozen)
26
27
/* Object shape flag -- when set, obj->iv is shaped, not iv_tbl* */
28
/* Bit 5: avoids conflict with MRB_INSTANCE_TT_MASK (bits 0-4);
29
but conflicts with MRB_HASH_AR_EA_N_USED on 32-bit, so the
30
predicate must also check tt to avoid false positives */
31
#define MRB_FL_OBJ_SHAPED (1 << 5)
32
#define MRB_OBJ_SHAPED_P(o) ((o)->tt == MRB_TT_OBJECT && ((o)->flags & MRB_FL_OBJ_SHAPED))
33
34
struct
RObject
{
35
MRB_OBJECT_HEADER;
36
struct
iv_tbl
*iv;
37
};
38
#define mrb_obj_ptr(v) ((struct RObject*)(mrb_ptr(v)))
39
40
#define mrb_special_const_p(x) mrb_immediate_p(x)
41
42
struct
RFiber
{
43
MRB_OBJECT_HEADER;
44
struct
mrb_context
*cxt;
45
};
46
47
#define mrb_static_assert_object_size(st) \
48
mrb_static_assert(sizeof(st) <= sizeof(void*) * 5, \
49
#st " size must be within 5 words")
50
51
#endif
/* MRUBY_OBJECT_H */
RBasic
Definition
object.h:19
RFiber
Definition
object.h:42
RObject
Definition
object.h:34
iv_tbl
Definition
variable.c:16
mrb_context
Definition
mruby.h:196
Generated by
1.16.1